package com.ruoyi.ruoyiqywechat.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.qy.domain.User;
import com.ruoyi.common.qy.request.PreOrderRequest;
import com.ruoyi.common.qy.response.PreOrderResponse;
import com.ruoyi.common.qy.utils.CrmebUtil;
import com.ruoyi.ruoyiqywechat.service.OrderService;
import com.ruoyi.ruoyiqywechat.service.PcAppPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 订单
 */
@Slf4j
@RestController("StoreOrderFrontController")
@RequestMapping("order")
public class OrderController {
//    @Autowired
//    private OrderService orderService;
    /**
     * 预下单
     */
    //(value = "预下单")
//    @RequestMapping(value = "/pre/order", method = RequestMethod.POST)
//    public R<Map<String, Object>> preOrder(@RequestBody @Validated PreOrderRequest request) {
//        return R.ok(orderService.preOrder(request).getColumns());
//    }
//    /**
//     * 加载预下单
//     */
//    ///(value = "加载预下单")
//    @RequestMapping(value = "load/pre/{preOrderNo}", method = RequestMethod.GET)
//    public R<PreOrderResponse> loadPreOrder(@PathVariable String preOrderNo) {
//        return R.ok(orderService.loadPreOrder(preOrderNo));
//    }
//    /**
//     * 创建订单
//     */
//    //(value = "创建订单")
//    @RequestMapping(value = "/create", method = RequestMethod.GET)
//    public R<Map<String, Object>> createOrder(@RequestParam("preOrderNo") String preOrderNo) {
//        return R.ok(orderService.createOrder(preOrderNo).getColumns());
//    }


//    @Autowired
//    private PcAppPayService pcAppPayService;
    /**【h5支付】
     * @param memberId 会员id
     */
//    @GetMapping("/createOrderH5orGZH")
//    R<String> createOrderH5orGZH(@RequestParam("memberId") Long memberId,
//                                 @RequestParam("preOrderNo") String preOrderNo) throws Exception {
//
//        String url = pcAppPayService.createOrderH5orGZH(memberId,preOrderNo);
//        return R.ok(url);
//    }
}
